import React from 'react';
import { Card, Tree, Button, Space } from 'antd';
import type { DataNode } from 'antd/es/tree';

const PermissionsPage = () => {
    const treeData: DataNode[] = [
        {
            title: '系统管理',
            key: 'system',
            children: [
                {
                    title: '用户管理',
                    key: 'user',
                    children: [
                        { title: '查看用户', key: 'user:view' },
                        { title: '创建用户', key: 'user:create' },
                        { title: '编辑用户', key: 'user:edit' },
                        { title: '删除用户', key: 'user:delete' },
                    ],
                },
                {
                    title: '角色管理',
                    key: 'role',
                    children: [
                        { title: '查看角色', key: 'role:view' },
                        { title: '创建角色', key: 'role:create' },
                        { title: '编辑角色', key: 'role:edit' },
                        { title: '删除角色', key: 'role:delete' },
                    ],
                },
            ],
        },
    ];

    return (
        <Card 
            title="权限设置" 
            extra={
                <Space>
                    <Button type="primary">保存设置</Button>
                    <Button>重置</Button>
                </Space>
            }
        >
            <Tree
                checkable
                defaultExpandAll
                treeData={treeData}
            />
        </Card>
    );
};

export default PermissionsPage; 